package com.emm.yixun.mobile.ui.subscribe;

import android.annotation.SuppressLint;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnKeyListener;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.alibaba.fastjson.JSONObject;
import com.emm.yixun.mobile.R;
import com.emm.yixun.mobile.adapter.AnnexAdapter;
import com.emm.yixun.mobile.adapter.JJAdapter;
import com.emm.yixun.mobile.adapter.NewFromAdapter;
import com.emm.yixun.mobile.adapter.PhoneSelectAdapter;
import com.emm.yixun.mobile.application.EmmApplication;
import com.emm.yixun.mobile.base.BaseActivity;
import com.emm.yixun.mobile.model.AddpirModel;
import com.emm.yixun.mobile.model.BusinessAudit;
import com.emm.yixun.mobile.model.GetConsultantList;
import com.emm.yixun.mobile.model.GetConsultantList.ConsultantList;
import com.emm.yixun.mobile.model.GetRoomList.RoomList;
import com.emm.yixun.mobile.model.GetSubscribeDetail;
import com.emm.yixun.mobile.model.NewClassKehuModel;
import com.emm.yixun.mobile.ui.RejectActivity;
import com.emm.yixun.mobile.ui.signed.NewSignedActivity;
import com.eroad.product.tools.MyGridView;
import com.eroad.product.tools.MyListView;
import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;
import com.yixun.app.viewpagerandimag.sample.ViewPagerActivity;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

import me.imid.swipebacklayout.lib.SwipeBackLayout;
import me.imid.swipebacklayout.lib.app.SwipeBackActivity;
import xf.tools.Loading;

/**
 * <p>
 * <b>Title：</b> 认购详情
 * </p>
 * <p>
 * <b>Description：</b>
 * </p>
 *
 * @author tangxin
 * @date 2016年12月6日 下午4:09:43
 */
public class SubscriDetailsActivity extends SwipeBackActivity {

    /**
     * 是否从审核列表过来 1 是，0否
     */
    private String IsToExamine = "0";

    /**
     * 认购ID（业务ID）
     */
    private String subscribeId = "";

    private static final String TAG = "NewSubscriDetailsActivity";

    /**
     * 房源信息
     */
    private boolean IsFangyuan = true;

    /**
     * 客户信息
     */
    private boolean IsKehu = true;

    private boolean IsYEWU = true;

    /**
     * 房源信息
     */
    LinearLayout fangyuan, fangyuan_layout, yewu_type, yewu_linear;

    /**
     * 客户信息
     */
    LinearLayout kehu, kehu_layout;
    ImageView rt1, rt2, rt0, rt3;

    TextView title_main;

    ImageView back_btn;

	/*---------------------------------------*/
    /**
     * 客户姓名
     */
    TextView user_name;

    /**
     * 星标
     */
    TextView user_star;

    /**
     * 性别
     */
    TextView user_sex;

    /**
     * 评分
     */
    TextView user_number;

    TextView customerStatus_view;

    TextView customerOrigin_view;

    /**
     * 认筹编号
     */
    TextView payDepositCode_view;

    /**
     * 认筹金
     */
    TextView payDepositMoney_view;

    /**
     * 认购房源
     */
    TextView housing_btn;

    /**
     * 计价面积
     */
    TextView calculateArea_view;

    /**
     * 折前单价
     */
    TextView discountPrice_view;

    /**
     * 折前总价
     */
    TextView discountTotalPrice_view;

    /**
     * 客户名称
     */
    TextView customerName_view;

    /**
     * 证件类型
     */
    TextView documentType_view;

    /**
     * 证件号码
     */
    TextView documentNumber_view;

    /**
     * 手机号
     */
    TextView mobile_view;

    /**
     * 邮寄地址
     */
    TextView mailPost_view;

    /**
     * 邮编
     */
    TextView postcode_view;

    /**
     * 家庭成员
     */
    MyListView kehuxinxi;

    ArrayList<NewClassKehuModel> list = new ArrayList<NewClassKehuModel>();

    NewFromAdapter adapter;

    /**
     * 折扣金额
     */
    TextView discountAmount_view;

    /**
     * 折扣比例
     */
    TextView discountRate_view;

    /**
     * 折扣审批状态
     */
    TextView zekoutype_view;

    /**
     * 审批人
     */
    TextView shenpi_p_view;

    /**
     * 审批时间
     */
    TextView shenpi_time_view;

    /**
     * 签约单价
     */
    TextView contractPrice_view;

    /**
     * 合同金额
     */
    TextView contractAmount_view;

    /**
     * 应收定金
     */
    TextView depositReceivable_view;

    /**
     * 日期
     */
    TextView dueTime_view;

    /**
     * 付款方式
     */
    TextView paymentMethod_view;

    /**
     * 成交类型
     */
    TextView dealCategory_view;

    /**
     * 经纪人
     */
    TextView agentId_view;

    /**
     * 认购日期
     */
    TextView subscribeDate_view;

    /**
     * 备注
     */
    TextView remark_view;

    /**
     * 认购编号
     */
    TextView subscribeCode_view;

    /**
     * 审核状态
     */
    TextView auditStatus_view;

    /**
     * 理由
     */
    TextView auditReason_view;

    /**
     * 审核人
     */
    TextView auditId_view;

    /**
     * 审核时间
     */
    TextView auditTime_view;

    LinearLayout buttom_select;

    /**
     * 申请驳回
     */
    TextView reject_btn;

    /**
     * 审核通过
     */
    TextView is_sure;

    /**
     * 1待提交 2待审核 3驳回 4成功
     */
    private int opentype = 0;

    /**
     * 竖线
     */
    TextView v_lins;

    /**
     * 认筹编号布局
     */
    LinearLayout is_none_for_gone1;

    View payDepositCode_view_lines;

    /**
     * 认筹金布局
     */
    LinearLayout is_none_for_gone2;

    View payDepositMoney_view_lines;

    /**
     * 业务状态
     */
    TextView yewu_view;

    /**
     * 审批
     */
    LinearLayout discount_linear;

    /**
     * 折扣说明
     */
    TextView discountNote_view;

    LinearLayout discountNote_linear;

	/*---------------------------------------*/

    /**
     * 客户ID
     */
    private String customerId;

    private String taskId;

    TextView phone_tel;

    LinearLayout callphone_3;

    MyListView jj_list;

    TextView realAmount_view;

    /**
     * 认筹转认购金额
     */
    LinearLayout realAmount_linearlayout;
    View realAmount_linearlayout_view;

    TextView realAmount_name_view;

    /**
     * 折后总价
     */
    TextView discountAmount_all_view;

    /**
     * 折后总价
     */
    LinearLayout reference_linear_layout, discountAmount_all_view_linear;

    /**
     * 推荐人
     */
    TextView referenceName;

    ImageView more_referenceName;

    /**
     * 推荐人分佣比例
     */
    TextView referenceProportion;

    /**
     * 侧滑关闭框架
     */
    private SwipeBackLayout mSwipeBackLayout;

    /**
     * 扫面列表grid
     */
    MyGridView grid_phone;

    /**
     * 合同扫面适配器
     */
    PhoneSelectAdapter padapter;

    ArrayList<AddpirModel> ap;

    /**
     * 图片附件
     */
    TextView from_htsm_view;

    /**
     * 合同扫面
     */
    private boolean IShtsm = true;

    /**
     * 合同扫面件
     */
    LinearLayout phone;

    /**
     * 扫面件
     */
    RelativeLayout phone_layout;

    ImageView rt1_p;

    /**
     * 附件布局
     */
    LinearLayout annex_layout;

    /**
     * 附件列表
     */
    MyListView annexList_list;

    /**
     * 附件数量
     */
    TextView annexNum_view;

    /**
     * 审核信息
     */
    private boolean IsAuditing = true;

    /**
     * 审核信息title
     */
    LinearLayout auditing_view;

    /**
     * 审核信息内容
     */
    LinearLayout auditing_c_layout;

    /**
     * 图片附件数量
     */
    TextView image_num;

    /**
     * 无附件显示
     */
    LinearLayout image_layout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.new_details_subscribe_activity);

        SetSwipeBackLayout(mSwipeBackLayout);

        BaseActivity.activity = this;

        subscribeId = getIntent().getStringExtra("subscribeId");

        IsToExamine = getIntent().getStringExtra("IsToExamine");

        customerId = getIntent().getStringExtra("customerId");

        taskId = getIntent().getStringExtra("taskId");

        initView();

        SetRelativiLayoutPadding(R.id.main_head_top_rela);

        initBtn();

        getSubscribeDetail();
    }

    /**
     * <p>
     * <b>Title：</b> 初始化view
     * </p>
     * <p>
     * <b>Description：</b>
     * </p>
     *
     * @author tangxin
     * @date 2016年12月7日 下午4:50:51
     */
    private void initView() {
        fangyuan = (LinearLayout) findViewById(R.id.fangyuan);
        fangyuan_layout = (LinearLayout) findViewById(R.id.fangyuan_layout);
        rt1 = (ImageView) findViewById(R.id.rt1);
        kehu = (LinearLayout) findViewById(R.id.kehu);
        kehu_layout = (LinearLayout) findViewById(R.id.kehu_layout);
        rt2 = (ImageView) findViewById(R.id.rt2);
        title_main = (TextView) findViewById(R.id.title_main);
        title_main.setText(getString(R.string.set_pdgoud_details));
        back_btn = (ImageView) findViewById(R.id.back_btn);
        phone_tel = (TextView) findViewById(R.id.phone_tel);
        user_name = (TextView) findViewById(R.id.user_name);
        user_star = (TextView) findViewById(R.id.user_star);
        user_sex = (TextView) findViewById(R.id.user_sex);
        user_number = (TextView) findViewById(R.id.user_number);
        customerStatus_view = (TextView) findViewById(R.id.customerStatus_view);
        customerOrigin_view = (TextView) findViewById(R.id.customerOrigin_view);
        payDepositCode_view = (TextView) findViewById(R.id.payDepositCode_view);
        payDepositMoney_view = (TextView) findViewById(R.id.payDepositMoney_view);
        housing_btn = (TextView) findViewById(R.id.housing_btn);
        calculateArea_view = (TextView) findViewById(R.id.calculateArea_view);
        discountPrice_view = (TextView) findViewById(R.id.discountPrice_view);
        discountTotalPrice_view = (TextView) findViewById(R.id.discountTotalPrice_view);
        customerName_view = (TextView) findViewById(R.id.customerName_view);
        documentType_view = (TextView) findViewById(R.id.documentType_view);
        documentNumber_view = (TextView) findViewById(R.id.documentNumber_view);
        mobile_view = (TextView) findViewById(R.id.mobile_view);
        mailPost_view = (TextView) findViewById(R.id.mailPost_view);
        postcode_view = (TextView) findViewById(R.id.postcode_view);
        kehuxinxi = (MyListView) findViewById(R.id.kehuxinxi);
        discountAmount_view = (TextView) findViewById(R.id.discountAmount_view);
        discountRate_view = (TextView) findViewById(R.id.discountRate_view);
        zekoutype_view = (TextView) findViewById(R.id.zekoutype_view);
        shenpi_p_view = (TextView) findViewById(R.id.shenpi_p_view);
        contractPrice_view = (TextView) findViewById(R.id.contractPrice_view);
        contractAmount_view = (TextView) findViewById(R.id.contractAmount_view);
        depositReceivable_view = (TextView) findViewById(R.id.depositReceivable_view);
        dueTime_view = (TextView) findViewById(R.id.dueTime_view);
        paymentMethod_view = (TextView) findViewById(R.id.paymentMethod_view);
        dealCategory_view = (TextView) findViewById(R.id.dealCategory_view);
        agentId_view = (TextView) findViewById(R.id.agentId_view);
        subscribeDate_view = (TextView) findViewById(R.id.subscribeDate_view);
        remark_view = (TextView) findViewById(R.id.remark_view);
        subscribeCode_view = (TextView) findViewById(R.id.subscribeCode_view);
        auditStatus_view = (TextView) findViewById(R.id.auditStatus_view);
        auditReason_view = (TextView) findViewById(R.id.auditReason_view);
        auditId_view = (TextView) findViewById(R.id.auditId_view);
        auditTime_view = (TextView) findViewById(R.id.auditTime_view);
        buttom_select = (LinearLayout) findViewById(R.id.buttom_select);
        reject_btn = (TextView) findViewById(R.id.reject_btn);
        is_sure = (TextView) findViewById(R.id.is_sure);
        v_lins = (TextView) findViewById(R.id.v_lins);
        shenpi_time_view = (TextView) findViewById(R.id.shenpi_time_view);
        rt0 = (ImageView) findViewById(R.id.rt0);
        yewu_linear = (LinearLayout) findViewById(R.id.yewu_linear);
        yewu_type = (LinearLayout) findViewById(R.id.yewu_type);
        is_none_for_gone1 = (LinearLayout) findViewById(R.id.is_none_for_gone1);
        payDepositCode_view_lines = findViewById(R.id.payDepositCode_view_lines);
        is_none_for_gone2 = (LinearLayout) findViewById(R.id.is_none_for_gone2);
        payDepositMoney_view_lines = findViewById(R.id.payDepositMoney_view_lines);
        yewu_view = (TextView) findViewById(R.id.yewu_view);
        discount_linear = (LinearLayout) findViewById(R.id.discount_linear);
        discountNote_view = (TextView) findViewById(R.id.discountNote_view);
        discountNote_linear = (LinearLayout) findViewById(R.id.discountNote_linear);
        discountAmount_all_view = (TextView) findViewById(R.id.discountAmount_all_view);
        realAmount_view = (TextView) findViewById(R.id.realAmount_view);
        realAmount_name_view = (TextView) findViewById(R.id.realAmount_name_view);
        realAmount_linearlayout = (LinearLayout) findViewById(R.id.realAmount_linearlayout);
        realAmount_linearlayout_view = findViewById(R.id.realAmount_linearlayout_view);
        phone = (LinearLayout) findViewById(R.id.phone);
        phone_layout = (RelativeLayout) findViewById(R.id.phone_layout);
        jj_list = (MyListView) findViewById(R.id.jj_list);

        callphone_3 = (LinearLayout) findViewById(R.id.callphone_3);
        discountAmount_all_view_linear = (LinearLayout) findViewById(R.id.discountAmount_all_view_linear);

        callphone_3.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if (phone_tel.getText().toString() == null || "".equals(phone_tel.getText().toString())
                        || TextUtils.isEmpty(phone_tel.getText().toString())) {
                    return;
                }
                EmmApplication.callPhone(phone_tel.getText().toString(), customerId);
            }
        });

        reference_linear_layout = (LinearLayout) findViewById(R.id.reference_linear_layout);
        referenceName = (TextView) findViewById(R.id.referenceName);
        more_referenceName = (ImageView) findViewById(R.id.more_referenceName);
        referenceProportion = (TextView) findViewById(R.id.referenceProportion);

        from_htsm_view = (TextView) findViewById(R.id.from_htsm_view);
        from_htsm_view.setText("图片附件");
        grid_phone = (MyGridView) findViewById(R.id.grid_phone);
        rt1_p = (ImageView) findViewById(R.id.rt1_p);
        annex_layout = (LinearLayout) findViewById(R.id.annex_layout);
        annexList_list = (MyListView) findViewById(R.id.annexList_list);
        annexNum_view = (TextView) findViewById(R.id.annexNum_view);
        auditing_view = (LinearLayout) findViewById(R.id.auditing_view);
        rt3 = (ImageView) findViewById(R.id.rt3);
        auditing_c_layout = (LinearLayout) findViewById(R.id.auditing_c_layout);
        image_num = (TextView) findViewById(R.id.image_num);
        image_layout = (LinearLayout) findViewById(R.id.image_layout);
    }

    @Override
    protected void onResume() {
        super.onResume();
        BaseActivity.activity = this;
        if ("1".equals(IsToExamine)) {// 从审核列表过来
            EmmApplication.IsReloadToExamine = true;
        }
        IntentFilter filter = new IntentFilter(EmmApplication.NEW_ON_CS_UB_SC_RI_DETAILS);
        registerReceiver(mBroadcastReceiver, filter);
        IntentFilter filter2 = new IntentFilter(EmmApplication.SUB_SC_RI_DETAILS_FI_NI_ACTIVITY);
        registerReceiver(mBroadcastReceiver, filter2);
    }

    private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            if (action.equals(EmmApplication.NEW_ON_CS_UB_SC_RI_DETAILS)) {
                // 刷新动作
                Log.v(TAG, ":-------");
                getSubscribeDetail();
            }
            if (action.equals(EmmApplication.SUB_SC_RI_DETAILS_FI_NI_ACTIVITY)) {
                Log.v(TAG, ":-------关闭界面");
                EmmApplication.IsReloadToExamine = true;
                finish();
            }
        }
    };

    protected void onDestroy() {
        super.onDestroy();
        EmmApplication.IsLoadingFromList = false;// 解除限制
        unregisterReceiver(mBroadcastReceiver);
    }

    ;

    /**
     * <p>
     * <b>Title：</b> 初始化监听事件以及界面展示判断
     * </p>
     * <p>
     * <b>Description：</b>
     * </p>
     *
     * @author tangxin
     * @date 2016年12月7日 下午4:51:31
     */
    private void initBtn() {
        IsOpenOrClose(fangyuan_layout, IsFangyuan, rt1);
        IsOpenOrClose(yewu_linear, IsYEWU, rt0);
        IsOpenOrClose(phone_layout, IShtsm, rt1_p);
        IsOpenOrClose(kehu_layout, IsKehu, rt2);
        IsOpenOrClose(auditing_c_layout, IsAuditing, rt3);
        yewu_type.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                DoKehuYeWu(IsYEWU);
            }
        });

        auditing_view.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                DoAuditing(IsAuditing);
            }
        });

        reject_btn.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                // 1待提交 2待审核 3驳回 4成功
                if (opentype == 1 || opentype == 3) {
                    EmmApplication.T("敬请期待");
                } else if (opentype == 4) {
                    // EmmApplication.T("敬请期待");
                    if ("0".equals(subRoomType)) {
                        EmmApplication.Ts(subRoomeMsg);
                    } else {

                        if ("0".equals(getsubscribe.getEnough())) {
                            EmmApplication.Ts("还未收完认购金");
                            return;
                        }

                        EmmApplication.IsGet = true;
                        if (EmmApplication.IsGet) {
                            EmmApplication.housinglist.clear();
                        }
                        RoomList b = new RoomList();
                        b.setRoomId(getsubscribe.getRoomId());
                        Log.v(TAG, "roomid:" + getsubscribe.getRoomId());
                        b.setRoomName(housing_btn.getText().toString().trim());
                        b.setDiscountAmount(discountAmount_view.getText().toString().trim());
                        b.setDiscountRate(getsubscribe.getDiscountRate());
                        b.setFloorType(getsubscribe.getFloorType());
                        b.setDiscountTotalPrice(getsubscribe.getDiscountTotalPrice());
                        EmmApplication.housinglist.add(b);

                        RoomList r = new RoomList();
                        r.setCalculateArea(calculateArea_view.getText().toString().trim());
                        r.setDiscountAmount(discountAmount_view.getText().toString().trim());
                        r.setDiscountPrice(discountPrice_view.getText().toString().trim());
                        r.setDiscountRate(discountRate_view.getText().toString().trim());
                        r.setDiscountTotalPrice(discountTotalPrice_view.getText().toString().trim());
                        r.setRoomId(getsubscribe.getRoomId());
                        r.setRoomName(housing_btn.getText().toString().trim());
                        EmmApplication.room = r;

                        if (null != getsubscribe.getDealCategoryList()) {
                            EmmApplication.dealCategoryList = getsubscribe.getDealCategoryList();
                        }

                        Intent intent = new Intent();
                        intent.putExtra("customerId", customerId);
                        intent.putExtra("OpenType", "6");
                        intent.putExtra("payDepositId", getsubscribe.getPayDepositId());
                        intent.putExtra("payDepositCode", getsubscribe.getPayDepositCode());
                        intent.putExtra("payDepositMoney", getsubscribe.getPayDepositMoney());
                        intent.putExtra("subscribeId", subscribeId);
                        intent.putExtra("subscribeCode", getsubscribe.getSubscribeCode());
                        intent.putExtra("subscribeAmount", getsubscribe.getDepositReceivable());
                        intent.putExtra("realAmount", getsubscribe.getRealAmount());
                        intent.putExtra("activitytype", "rg");
                        intent.putExtra("DealCategory", getsubscribe.getDealCategory());
                        intent.putExtra("PaymentMethod", getsubscribe.getPaymentMethod());
                        intent.putExtra("ReferenceName", getsubscribe.getReferenceName());
                        intent.putExtra("referenceProportion", getsubscribe.getReferenceProportion());
                        intent.setClass(SubscriDetailsActivity.this, NewSignedActivity.class);
                        startActivity(intent);
                    }
                }
                if ("1".equals(IsToExamine)) {// 从审核列表过来
                    Intent intent = new Intent();
                    intent.setClass(SubscriDetailsActivity.this, RejectActivity.class);
                    intent.putExtra("businessType", "2");
                    intent.putExtra("taskId", taskId);
                    intent.putExtra("payDepositId", subscribeId);
                    startActivity(intent);
                }
            }
        });

        is_sure.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                // 1待提交 2待审核 3驳回 4成功
                if (opentype == 1 || opentype == 3) {
                    EmmApplication.getsubscribe = getsubscribe;
                    Intent intent = new Intent();
                    intent.putExtra("customerId", customerId);
                    intent.putExtra("OpenType", "12");
                    intent.putExtra("payDepositId", getsubscribe.getPayDepositId());
                    intent.putExtra("subscribeId", subscribeId);
                    intent.setClass(SubscriDetailsActivity.this, NewSubscribeActivity.class);
                    startActivity(intent);
                } else if (opentype == 4) {
                    EmmApplication.T("敬请期待");
                }
                if ("1".equals(IsToExamine)) {// 从审核列表过来
                    popu();
                }

            }
        });

        phone.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                DoHTSMOpenOrClose(IShtsm);
            }
        });

        fangyuan.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                DoOpenOrClose(IsFangyuan);
            }
        });
        kehu.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                DoKehuOpenOrClose(IsKehu);
            }
        });
        back_btn.setVisibility(View.VISIBLE);
        back_btn.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
                if (EmmApplication.IsReload != 1) {
                    EmmApplication.IsReload = 1;
                    sendBroadcast(new Intent(EmmApplication.NEW_ON_CREATE_FROM_LIST));
                }
                if ("1".equals(IsToExamine)) {// 从审核列表过来
                    EmmApplication.IsReloadToExamine = true;
                }
            }
        });

        padapter = new PhoneSelectAdapter(SubscriDetailsActivity.this, ap, 0);
        grid_phone.setAdapter(padapter);
        grid_phone.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                if ("1".equals(ap.get(position).getType())) {
                    ViewPagerActivity.postion = position;
                    ViewPagerActivity.sDrawables.clear();
                    for (int u = 0; u < ap.size(); u++) {
                        if ("1".equals(ap.get(u).getType())) {
                            ViewPagerActivity.sDrawables.add(ap.get(u).getPath());
                        }
                    }
                    Intent intent = new Intent(SubscriDetailsActivity.this, ViewPagerActivity.class);
                    startActivity(intent);
                }
            }
        });
    }

    /**
     * <p>
     * <b>Title：</b> 判断各展开状况
     * </p>
     * <p>
     * <b>Description：</b>
     * </p>
     *
     * @param view
     * @param bl
     * @param view2
     * @author tangxin
     * @date 2016年12月7日 下午4:52:39
     */
    private void IsOpenOrClose(View view, boolean bl, ImageView view2) {
        if (bl) {
            view.setVisibility(View.VISIBLE);
            view2.setImageResource(R.drawable.j_bottom);
        } else {
            view.setVisibility(View.GONE);
            view2.setImageResource(R.drawable.j_top);
        }
    }

    /**
     * <p>
     * <b>Title：</b> 判断操作中的房源模块的展开状况
     * </p>
     * <p>
     * <b>Description：</b>
     * </p>
     *
     * @param bl
     * @author tangxin
     * @date 2016年12月7日 下午4:52:56
     */
    private void DoOpenOrClose(boolean bl) {
        if (!bl) {
            IsFangyuan = true;
            fangyuan_layout.setVisibility(View.VISIBLE);
            rt1.setImageResource(R.drawable.j_bottom);
        } else {
            IsFangyuan = false;
            fangyuan_layout.setVisibility(View.GONE);
            rt1.setImageResource(R.drawable.j_top);
        }
    }

    /**
     * <p>
     * <b>Title：</b> 判断操作中的客户信息模块的展开状况
     * </p>
     * <p>
     * <b>Description：</b>
     * </p>
     *
     * @param bl
     * @author tangxin
     * @date 2016年12月7日 下午4:53:03
     */
    private void DoKehuOpenOrClose(boolean bl) {
        if (!bl) {
            IsKehu = true;
            kehu_layout.setVisibility(View.VISIBLE);
            rt2.setImageResource(R.drawable.j_bottom);
        } else {
            IsKehu = false;
            kehu_layout.setVisibility(View.GONE);
            rt2.setImageResource(R.drawable.j_top);
        }
    }

    /**
     * <p>
     * <b>Title：</b> 判断操作中的客户信息模块的展开状况
     * </p>
     * <p>
     * <b>Description：</b>
     * </p>
     *
     * @param bl
     * @author tangxin
     * @date 2016年12月7日 下午4:53:17
     */
    private void DoKehuYeWu(boolean bl) {
        if (!bl) {
            IsYEWU = true;
            yewu_linear.setVisibility(View.VISIBLE);
            rt0.setImageResource(R.drawable.j_bottom);
        } else {
            IsYEWU = false;
            yewu_linear.setVisibility(View.GONE);
            rt0.setImageResource(R.drawable.j_top);
        }
    }

    /**
     * <p>
     * <b>Title：</b> 判断操作中的审核信息模块的展开状况
     * </p>
     * <p>
     * <b>Description：</b>
     * </p>
     *
     * @param bl
     * @author tangxin
     * @date 2016年12月7日 下午4:53:17
     */
    private void DoAuditing(boolean bl) {
        if (!bl) {
            IsAuditing = true;
            auditing_c_layout.setVisibility(View.VISIBLE);
            rt3.setImageResource(R.drawable.j_bottom);
        } else {
            IsAuditing = false;
            auditing_c_layout.setVisibility(View.GONE);
            rt3.setImageResource(R.drawable.j_top);
        }
    }

    /**
     * <p>
     * <b>Title：</b> 判断操作中的合同扫面件的展开状况
     * </p>
     * <p>
     * <b>Description：</b>
     * </p>
     *
     * @param bl
     * @author tangxin
     * @date 2016年12月7日 下午4:48:52
     */
    private void DoHTSMOpenOrClose(boolean bl) {
        if (!bl) {
            IShtsm = true;
            phone_layout.setVisibility(View.VISIBLE);
            rt1_p.setImageResource(R.drawable.j_bottom);
        } else {
            IShtsm = false;
            phone_layout.setVisibility(View.GONE);
            rt1_p.setImageResource(R.drawable.j_top);
        }
    }

    View view3;
    PopupWindow popu_call;

    /**
     * <p>
     * <b>Title：</b> 审核通过弹出框
     * </p>
     * <p>
     * <b>Description：</b>
     * </p>
     *
     * @author tangxin
     * @date 2016年12月7日 下午4:53:25
     */
    @SuppressLint("WrongConstant")
    private void popu() {
        view3 = LayoutInflater.from(SubscriDetailsActivity.this).inflate(R.layout.is_sure_popu, null);
        popu_call = new PopupWindow(view3, android.support.v4.view.ViewPager.LayoutParams.FILL_PARENT,
                android.support.v4.view.ViewPager.LayoutParams.FILL_PARENT);
        popu_call.setFocusable(true);

        popu_call.setSoftInputMode(PopupWindow.INPUT_METHOD_NEEDED);
        popu_call.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

        popu_call.showAtLocation(view3, Gravity.CENTER, 0, 0);
        popu_call.showAsDropDown(view3, 0, 0);
        popu_call.setFocusable(true);
        popu_call.setOutsideTouchable(true);
        view3.setFocusable(true);
        view3.setFocusableInTouchMode(true);

        view3.setOnKeyListener(new OnKeyListener() {
            @Override
            public boolean onKey(View v, int keyCode, KeyEvent event) {
                if (keyCode == KeyEvent.KEYCODE_BACK) {
                }
                return false;
            }
        });
        // 取消
        TextView dismiss = (TextView) view3.findViewById(R.id.dismiss);
        // 确定
        TextView shuerbtn = (TextView) view3.findViewById(R.id.shuerbtn);
        // 输入框
        final TextView content_ed = (TextView) view3.findViewById(R.id.content_ed);

        dismiss.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                popu_call.dismiss();
            }
        });
        shuerbtn.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                popu_call.dismiss();
                // 校验成功之后的操作
                businessAudit("认购", "1", content_ed.getText().toString().trim());
            }
        });
    }

    JJAdapter jjadapter;

    ArrayList<com.emm.yixun.mobile.ui.signed.NewSignedActivity.JJInfo> jjlist = new ArrayList<NewSignedActivity.JJInfo>();

    BusinessAudit businessaudit;

    /**
     * <p>
     * <b>Title：</b> 审核接口
     * </p>
     * <p>
     * <b>Description：</b>
     * </p>
     *
     * @param businessType 业务类型
     * @param auditStatus  审核状态
     * @param remark       备注
     * @author tangxin
     * @date 2016年12月7日 下午4:53:43
     */
    private void businessAudit(String businessType, String auditStatus, String remark) {
        EmmApplication.updateUrl("businessAudit");
        Map<String, String> map = new HashMap<String, String>();
        map.put("version", EmmApplication.getPackageManager(5));
        map.put("merchantId", EmmApplication.getData(EmmApplication.merchantId));
        map.put("token", EmmApplication.getToken());
        map.put("userId", EmmApplication.getUserId());
        map.put("terminalCode", EmmApplication.getPackageManager(2));
        map.put("projectCode", EmmApplication.getProjectCode());
        map.put("businessId", subscribeId);// 业务ID
        map.put("businessType", businessType);
        map.put("taskId", taskId);
        map.put("auditStatus", auditStatus);
        map.put("remark", remark);
        Map<String, Object> paramsMap = new HashMap<String, Object>();
        paramsMap.put("params", map);
        JSONObject json = new JSONObject(paramsMap);
        String jsonstr = json.toString();
        RequestParams params = new RequestParams();
        params.put("body", jsonstr);
        Log.v("businessAudit-->post", EmmApplication.urlStr + "?body=" + jsonstr);
        AsyncHttpClient asyncHttpClient = new AsyncHttpClient();
        asyncHttpClient.post(EmmApplication.urlStr, params, new AsyncHttpResponseHandler() {
            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                Loading.hideDialogForLoading();
                Log.v(TAG, "请求结束error:" + error + "==" + content);
            }

            @Override
            public void onFinish() {
                Loading.hideDialogForLoading();
                Log.v(TAG, "请求结束");
                super.onFinish();
            }

            @Override
            public void onStart() {
                super.onStart();
                Loading.hideDialogForLoading();
                Loading.showDialogForLoading(SubscriDetailsActivity.this, "正在加载...", false, true, 60000);
                Log.v(TAG, "请求开始");
            }

            @Override
            public void onSuccess(String content) {
                super.onSuccess(content);
                if (content == null) {
                    return;
                }
                JSONObject jsonObj = JSONObject.parseObject(content);
                JSONObject resData = (JSONObject) jsonObj.get("resData");
                if (resData == null) {
                    Log.v(TAG, "信息返回值为空");
                    return;
                }
                businessaudit = JSONObject.parseObject(resData.toString(), BusinessAudit.class);
                if ("1".equals(businessaudit.getResult())) {
                    Log.v("获取成功", "");
                    EmmApplication.T("审核成功");
                    EmmApplication.IsReloadToExamine = true;
                    finish();
                } else {
                    EmmApplication.T(businessaudit.getErrorMsg().toString());
                    Log.v("获取失败", "errorCode:" + businessaudit.getErrorCode().toString() + "errorMsg:"
                            + businessaudit.getErrorMsg().toString());
                }

            }
        });
    }

    GetSubscribeDetail getsubscribe;

    private String subRoomType = "999";

    private String subRoomeMsg = "";

    /**
     * <p>
     * <b>Title：</b> 查看认购详情接口
     * </p>
     * <p>
     * <b>Description：</b>
     * </p>
     *
     * @author tangxin
     * @date 2016年12月7日 下午4:55:10
     */
    private void getSubscribeDetail() {
        EmmApplication.updateUrl("getSubscribeDetail");
        Map<String, String> map = new HashMap<String, String>();
        map.put("version", EmmApplication.getPackageManager(5));
        map.put("merchantId", EmmApplication.getData(EmmApplication.merchantId));
        map.put("token", EmmApplication.getToken());
        map.put("userId", EmmApplication.getUserId());
        map.put("terminalCode", EmmApplication.getPackageManager(2));
        map.put("projectCode", EmmApplication.getProjectCode());
        map.put("subscribeId", subscribeId);
        map.put("isAudit", IsToExamine);
        Map<String, Object> paramsMap = new HashMap<String, Object>();
        paramsMap.put("params", map);
        JSONObject json = new JSONObject(paramsMap);
        String jsonstr = json.toString();
        RequestParams params = new RequestParams();
        params.put("body", jsonstr);
        Log.v(TAG, "getSubscribeDetail-->post:" + EmmApplication.urlStr + "?body=" + jsonstr);
        AsyncHttpClient asyncHttpClient = new AsyncHttpClient();
        asyncHttpClient.post(EmmApplication.urlStr, params, new AsyncHttpResponseHandler() {
            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                Loading.hideDialogForLoading();
                Log.v(TAG, "请求结束error:" + error + "==" + content);
            }

            @Override
            public void onFinish() {
                Loading.hideDialogForLoading();
                Log.v(TAG, "请求结束");
                super.onFinish();
            }

            @Override
            public void onStart() {
                super.onStart();
                Loading.hideDialogForLoading();
                Loading.showDialogForLoading(SubscriDetailsActivity.this, "正在加载...", false, true, 60000);
                Log.v(TAG, "请求开始");
            }

            @Override
            public void onSuccess(String content) {
                super.onSuccess(content);
                if (content == null) {
                    return;
                }
                Log.v(TAG, "content=>" + content);
                JSONObject jsonObj = JSONObject.parseObject(content);
                JSONObject resData = (JSONObject) jsonObj.get("resData");
                if (resData == null) {
                    Log.v(TAG, "信息返回值为空");
                    return;
                }

                getsubscribe = JSONObject.parseObject(resData.toString(), GetSubscribeDetail.class);

                if ("1".equals(getsubscribe.getResult())) {
                    Log.v("获取成功", "");
                    String str = getsubscribe.getDiscountAfterAmount();
                    if (EmmApplication.isNull(str)) {
                        discountAmount_all_view.setText(str);
                        discountAmount_all_view_linear.setVisibility(View.VISIBLE);
                    } else {
                        discountAmount_all_view_linear.setVisibility(View.GONE);
                    }

                    String sttt;
                    try {
                        sttt = getsubscribe.getBusReturnType();
                    } catch (NullPointerException e) {
                        sttt = "0";
                    }
                    if ("1".equals(sttt)) {// 认筹
                        realAmount_linearlayout.setVisibility(View.VISIBLE);
                        realAmount_linearlayout_view.setVisibility(View.VISIBLE);
                        realAmount_name_view.setText("已收认筹金");
                        realAmount_view.setText(getsubscribe.getRealAmount());
                    } else if ("2".equals(sttt)) {// 认购
                        realAmount_linearlayout.setVisibility(View.VISIBLE);
                        realAmount_linearlayout_view.setVisibility(View.VISIBLE);
                        realAmount_name_view.setText("已收认购金");
                        realAmount_view.setText(getsubscribe.getRealAmount());
                    } else {
                        realAmount_linearlayout.setVisibility(View.GONE);
                        realAmount_linearlayout_view.setVisibility(View.GONE);
                    }

                    if ("".equals(getsubscribe.getDiscountAfterAmount())
                            || null == getsubscribe.getDiscountAfterAmount()
                            || TextUtils.isEmpty(getsubscribe.getDiscountAfterAmount())) {
                    } else {
                        String stp = getsubscribe.getDiscountAfterAmount();
                        getsubscribe.setDiscountAfterAmount(EmmApplication.drop2("" + (Double.valueOf(stp).doubleValue()
                                // * 10000
                        )));
                    }

                    try {
                        subRoomeMsg = getsubscribe.getSubRoomeMsg();
                        subRoomType = getsubscribe.getSubRoomType();
                    } catch (NullPointerException e) {
                        Log.v(TAG, "subRoomType-->为空");
                        subRoomType = "999";
                    }

                    try {
                        subRoomeMsg = getsubscribe.getSubRoomeMsg();
                    } catch (NullPointerException e) {
                    }

                    if (null == getsubscribe.getImageList() || getsubscribe.getImageList().size() <= 0) {
                        image_num.setVisibility(View.GONE);
                        ArrayList<AddpirModel> listap = new ArrayList<AddpirModel>();
                        if (null == padapter) {
                            padapter = new PhoneSelectAdapter(SubscriDetailsActivity.this, listap, 0);
                            grid_phone.setAdapter(padapter);
                        } else {
                            padapter.SetDate(listap);
                        }
                    } else {
                        image_layout.setVisibility(View.GONE);
                        ap = new ArrayList<AddpirModel>();
                        for (int i = 0; i < getsubscribe.getImageList().size(); i++) {
                            AddpirModel a = new AddpirModel();
                            a.setIsnet("2");// 是否网络图片
                            a.setType("1");// 图片或添加
                            a.setPath(getsubscribe.getImageList().get(i).getSmallUrl());// 图片路径
                            ap.add(a);
                        }
                        image_num.setVisibility(View.VISIBLE);
                        image_num.setText(" (" + getsubscribe.getImageList().size() + ")");
                        grid_phone.setNumColumns(1);
                        ArrayList<AddpirModel> listap = new ArrayList<AddpirModel>();
                        listap.add(ap.get(0));
                        if (null == padapter) {
                            padapter = new PhoneSelectAdapter(SubscriDetailsActivity.this, listap, 0);
                            grid_phone.setAdapter(padapter);
                        } else {
                            padapter.SetDate(listap);
                        }
                    }

                    // 清除缓存数据
                    jjlist.clear();
                    if (null != getsubscribe.getDealCategoryList() && getsubscribe.getDealCategoryList().size() > 0) {
                        for (int i = 0; i < getsubscribe.getDealCategoryList().size(); i++) {
                            com.emm.yixun.mobile.ui.signed.NewSignedActivity.JJInfo jinfo = new com.emm.yixun.mobile.ui.signed.NewSignedActivity.JJInfo();
                            jinfo.setName(getsubscribe.getDealCategoryList().get(i).getRelationAgentName());
                            jinfo.setNumber(getsubscribe.getDealCategoryList().get(i).getProportionCommission());
                            jinfo.setPid(getsubscribe.getDealCategoryList().get(i).getRelationAgentId());
                            jjlist.add(jinfo);
                        }
                        ArrayList<GetConsultantList.ConsultantList> consultantList = new ArrayList<ConsultantList>();
                        jjadapter = new JJAdapter(jjlist, SubscriDetailsActivity.this, consultantList);
                        jj_list.setAdapter(jjadapter);
                        jjadapter.SetType(1);
                    }

                    phone_tel.setText(getsubscribe.getCustomerPhone());

                    if ("".equals(getsubscribe.getDiscountNote()) || "null".equals(getsubscribe.getDiscountNote())
                            || null == getsubscribe.getDiscountNote()) {
                        discountNote_view.setVisibility(View.GONE);
                        discountNote_linear.setVisibility(View.GONE);
                    } else {
                        discountNote_view.setVisibility(View.VISIBLE);
                        discountNote_linear.setVisibility(View.VISIBLE);
                        discountNote_view.setText(getsubscribe.getDiscountNote());
                    }

                    yewu_view.setText(getsubscribe.getBusinessStatus());

                    user_name.setText(getsubscribe.getCustomerName());

                    user_star.setVisibility("是".equals(getsubscribe.getCustomerStar()) == true ? View.VISIBLE
                            : View.INVISIBLE);

                    user_sex.setText(getsubscribe.getCustomerSex());

                    user_number.setText(getsubscribe.getIntentionLevel());

                    customerStatus_view.setText(getsubscribe.getCustomerStatus());

                    customerOrigin_view.setText(getsubscribe.getCustomerOrigin());

                    if (EmmApplication.isNull(getsubscribe.getPayDepositCode())) {
                        payDepositCode_view.setText(getsubscribe.getPayDepositCode());
                        is_none_for_gone1.setVisibility(View.VISIBLE);
                        payDepositCode_view_lines.setVisibility(View.VISIBLE);
                    } else {
                        is_none_for_gone1.setVisibility(View.GONE);
                        payDepositCode_view_lines.setVisibility(View.GONE);
                    }

                    if (EmmApplication.isNull(getsubscribe.getPayDepositMoney())) {
                        payDepositMoney_view.setText(getsubscribe.getPayDepositMoney());
                        is_none_for_gone2.setVisibility(View.VISIBLE);
                        payDepositMoney_view_lines.setVisibility(View.VISIBLE);
                    } else {
                        is_none_for_gone2.setVisibility(View.GONE);
                        payDepositMoney_view_lines.setVisibility(View.GONE);
                    }

                    payDepositMoney_view.setText(getsubscribe.getPayDepositMoney());

                    housing_btn.setText(getsubscribe.getSubscribeHouses());

                    calculateArea_view.setText(getsubscribe.getCalculateArea());

                    discountPrice_view.setText(getsubscribe.getDiscountPrice());

                    discountTotalPrice_view.setText(getsubscribe.getDiscountTotalPrice());

                    customerName_view.setText(getsubscribe.getCustomerName());

                    documentType_view.setText(getsubscribe.getDocumentType());

                    documentNumber_view.setText(getsubscribe.getDocumentNumber());

                    mobile_view.setText(getsubscribe.getMobile());

                    mailPost_view.setText(getsubscribe.getMailPost());

                    postcode_view.setText(getsubscribe.getPostcode());

                    if (null != getsubscribe.getCustomerFamilyList() && getsubscribe.getCustomerFamilyList().size() > 0) {

                        ArrayList<NewClassKehuModel> list = new ArrayList<NewClassKehuModel>();
                        for (int i = 0; i < getsubscribe.getCustomerFamilyList().size(); i++) {
                            NewClassKehuModel m = new NewClassKehuModel();
                            m.setCode(getsubscribe.getCustomerFamilyList().get(i).getDocumentNumber());
                            m.setName(getsubscribe.getCustomerFamilyList().get(i).getMemberName());
                            m.setNumber("" + (i + 1));
                            list.add(m);
                        }
                        adapter = new NewFromAdapter(SubscriDetailsActivity.this, list);
                        kehuxinxi.setAdapter(adapter);
                        adapter.SetType(1);
                    }

                    discountAmount_view.setText(getsubscribe.getDiscountAmount());

                    discountRate_view.setText(EmmApplication.isNull(getsubscribe.getAddDiscountRate()) ? getsubscribe
                            .getAddDiscountRate() : "0");// 折扣比例

                    if ("0".equals(getsubscribe.getDiscountApproval())) {// 不需要审批的，隐藏
                        discount_linear.setVisibility(View.GONE);
                    } else {
                        discount_linear.setVisibility(View.VISIBLE);
                        zekoutype_view.setText(getsubscribe.getDiscountApprovalStatus());// 折扣审批状态
                        shenpi_p_view.setText(getsubscribe.getDiscountApprovalPeople());// 审批人
                        shenpi_time_view.setText(getsubscribe.getDiscountApprovalTime());// 审批时间
                    }

                    contractPrice_view.setText(getsubscribe.getContractPrice());

                    contractAmount_view.setText(getsubscribe.getContractAmount());

                    depositReceivable_view.setText(getsubscribe.getDepositReceivable());

                    dueTime_view.setText(getsubscribe.getDueTime());

                    paymentMethod_view.setText(getsubscribe.getPaymentMethod());

                    dealCategory_view.setText(getsubscribe.getDealCategory());

                    if ("推荐成交".equals(dealCategory_view.getText().toString().trim())) {
                        reference_linear_layout.setVisibility(View.VISIBLE);
                        referenceName.setText(getsubscribe.getReferenceName());
                        referenceProportion.setText(EmmApplication.drop2(getsubscribe.getReferenceProportion()));
                    } else {
                        reference_linear_layout.setVisibility(View.GONE);
                    }

                    agentId_view.setText(getsubscribe.getAgentId());

                    subscribeDate_view.setText(getsubscribe.getSubscribeDate());

                    if (EmmApplication.isNull(getsubscribe.getRemark())) {
                        remark_view.setTextColor(getResources().getColor(R.color.text_right));
                        remark_view.setText(getsubscribe.getRemark());
                    } else {
                        remark_view.setTextColor(getResources().getColor(R.color.edittext_hint_color));
                        remark_view.setText("暂无备注");
                    }

                    subscribeCode_view.setText(getsubscribe.getSubscribeCode());

                    auditStatus_view.setText(getsubscribe.getAuditStatus());

                    auditReason_view.setText(getsubscribe.getAuditReason());

                    auditId_view.setText(getsubscribe.getAuditId());

                    auditTime_view.setText(getsubscribe.getAuditTime());

                    if (null == getsubscribe.getAnnexNum() || "0".equals(getsubscribe.getAnnexNum())
                            || "null".equals(getsubscribe.getAnnexNum())) {
                        annex_layout.setVisibility(View.GONE);
                        image_layout.setVisibility(View.GONE);
                        if (null == getsubscribe.getImageList() || getsubscribe.getImageList().size() <= 0) {
                            // 显示没有附件图片
                            image_layout.setVisibility(View.VISIBLE);
                        }
                    } else {
                        image_layout.setVisibility(View.GONE);
                        annexNum_view.setText("存在以下" + getsubscribe.getAnnexNum() + "个非图片附件，请通过电脑端查看");
                        annex_layout.setVisibility(View.VISIBLE);
                        AnnexAdapter annexAdapter = new AnnexAdapter(SubscriDetailsActivity.this, getsubscribe
                                .getAnnexList());
                        annexList_list.setAdapter(annexAdapter);
                    }

                    if ("1".equals(IsToExamine)) {
                        buttom_select.setVisibility(View.VISIBLE);
                        is_sure.setVisibility(View.VISIBLE);
                        is_sure.setText("审核通过");
                        reject_btn.setVisibility(View.VISIBLE);
                        reject_btn.setText("审核退回");
                    } else {
                        // 待提交 待审核 驳回 成功
                        if ("待提交".equals(getsubscribe.getAuditStatus())) {// "待提交".equals(getsubscribe.getAuditStatus())
                            buttom_select.setVisibility(View.VISIBLE);
                            v_lins.setVisibility(View.GONE);
                            reject_btn.setVisibility(View.GONE);
                            is_sure.setVisibility(View.VISIBLE);
                            is_sure.setText("认购");
                            opentype = 1;
                        } else if ("审核中".equals(getsubscribe.getAuditStatus())) {// "待审核".equals(getsubscribe.getAuditStatus())
                            opentype = 2;
                            buttom_select.setVisibility(View.GONE);
                        } else if ("已退回".equals(getsubscribe.getAuditStatus())
                                || (null != getsubscribe.getDiscountApprovalStatus() && "已退回".equals(getsubscribe
                                .getDiscountApprovalStatus()))) {// "驳回".equals(getsubscribe.getAuditStatus())
                            opentype = 3;
                            buttom_select.setVisibility(View.VISIBLE);
                            v_lins.setVisibility(View.GONE);
                            reject_btn.setVisibility(View.GONE);
                            is_sure.setVisibility(View.VISIBLE);
                            is_sure.setText("认购");
                        } else if ("已通过".equals(getsubscribe.getAuditStatus()) && !"认购退房".equals(getsubscribe.getBusinessStatus())) {// "成功".equals(getsubscribe.getAuditStatus())
                            opentype = 4;
                            buttom_select.setVisibility(View.VISIBLE);
                            v_lins.setVisibility(View.GONE);
                            is_sure.setText("认购");
                            is_sure.setVisibility(View.GONE);
                            reject_btn.setText("签约");
                            reject_btn.setVisibility(View.VISIBLE);
                        } else {
                            buttom_select.setVisibility(View.GONE);
                        }
                    }
                } else {
                    EmmApplication.T(getsubscribe.getErrorMsg().toString());
                    Log.v("获取失败", "errorCode:" + getsubscribe.getErrorCode().toString() + "errorMsg:"
                            + getsubscribe.getErrorMsg().toString());
                }
            }
        });
    }

}
